package com.serwis.app.entities;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="T_STATUS")
public class Status implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private int statusId;
	private String code;
	private String name;
	private String description;
	private Set<Reservation> reservation = new HashSet<Reservation>();
	private Set<RetailOrder> retailOrders = new HashSet<RetailOrder>();
	private Set<DelivererOrder> delivererOrders = new HashSet<DelivererOrder>();
	
	public Status(){
	}
	
	public Status(String code, String name){
		this.code = code;
		this.name = name;
	}
	
	public Status(String code, String name, String description){
		this.code = code;
		this.name = name;
		this.description = description;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="STATUS_ID",unique = true, nullable = false)
	public int getStatusId() {
		return statusId;
	}

	public void setStatusId(int statusId) {
		this.statusId = statusId;
	}

	@Column(name="CODE", nullable=false)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name="NAME", nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name="DESCRIPTION", nullable=true)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL)
	public Set<Reservation> getReservation() {
		return reservation;
	}

	public void setReservation(Set<Reservation> reservation) {
		this.reservation = reservation;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL)
	public Set<RetailOrder> getRetailOrders() {
		return retailOrders;
	}

	public void setRetailOrders(Set<RetailOrder> retailOrders) {
		this.retailOrders = retailOrders;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "status", cascade = CascadeType.ALL)
	public Set<DelivererOrder> getDelivererOrders() {
		return delivererOrders;
	}

	public void setDelivererOrders(Set<DelivererOrder> delivererOrders) {
		this.delivererOrders = delivererOrders;
	}
	
	
	
	
}
